#!/bin/bash

# 检查IPv4源路由是否已禁用
if [[ $(sysctl -n net.ipv4.conf.all.accept_source_route 2>/dev/null) -eq 0 ]]; then
    echo "通过：IPv4 all accept_source_route 已禁用"
else
    echo "失败：IPv4 all accept_source_route 未禁用"
    exit 1
fi

if [[ $(sysctl -n net.ipv4.conf.default.accept_source_route 2>/dev/null) -eq 0 ]]; then
    echo "通过：IPv4 default accept_source_route 已禁用"
else
    echo "失败：IPv4 default accept_source_route 未禁用"
    exit 1
fi

# 检查IPv6源路由是否已禁用
if [[ $(sysctl -n net.ipv6.conf.all.accept_source_route 2>/dev/null) -eq 0 ]]; then
    echo "通过：IPv6 all accept_source_route 已禁用"
else
    echo "失败：IPv6 all accept_source_route 未禁用"
    exit 1
fi

if [[ $(sysctl -n net.ipv6.conf.default.accept_source_route 2>/dev/null) -eq 0 ]]; then
    echo "通过：IPv6 default accept_source_route 已禁用"
else
    echo "失败：IPv6 default accept_source_route 未禁用"
    exit 1
fi
